package com.woniu.goodsservice.dao;

import com.woniu.goodsservice.dto.GoodsResultDTO;
import com.woniu.goodsservice.entity.Goods;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface GoodsDao {
    Goods queryById(Integer id);

    List<Goods> queryAllByLimit(@Param("offset") int offset, @Param("limit") int limit);
    
    List<Goods> findAll();

    List<Goods> queryAll(Goods goods);

    int insert(Goods goods);

    int update(Goods goods);

    int deleteById(Integer id);

    List<Goods> selectGoodsDataByPage(Integer currentPage, Integer pageSize, GoodsResultDTO goodsResultDTO);
    List<Goods> selectByPage();

    @Select("select * from goods where goodsid=#{goodsid}")
    Goods queryByGoodsid(Integer goodsid);
    List<Goods> selectGoodsDataByPage(Integer currentPage, Integer pageSize);

    Goods selectGoodsDataById(Integer id);
    @Update("update goods set goodsStatus=#{newStatus} where id=#{goodsId}")
    void updateStatus(Integer newStatus, Integer goodsId);
}